﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1.segments.data_type
{
    class CM_RI
    {
        public StringBuilder Repeat_Pattern { get; set; }
        public StringBuilder Explicit_Time_Intevall { get; set; }

        public int fill(string source, int temp)
        {
            int i, x = 0;
            for (i = temp; i < source.Length; i++)
            {
                if (source[i] == '^')
                    x++;
                else if (source[i] == '|')
                {
                    Repeat_Pattern.Capacity = Repeat_Pattern.Length;
                    Explicit_Time_Intevall.Capacity = Explicit_Time_Intevall.Length;
                    return i;
                }

                else if (x == 0)
                {
                    if (Repeat_Pattern == null)
                        Repeat_Pattern = new StringBuilder();
                    Repeat_Pattern.Insert(Repeat_Pattern.Length, source[i]);
                }
                else if (x == 1)
                {
                    if (Explicit_Time_Intevall == null)
                        Explicit_Time_Intevall = new StringBuilder();
                    Explicit_Time_Intevall.Insert(Explicit_Time_Intevall.Length, source[i]);
                }
            }
            return i;
        }
    }
}
